package org.demo2.springmvc_demo2.service;


import org.demo2.springmvc_demo2.entity.User;
import org.demo2.springmvc_demo2.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {
    @Autowired
    private UserMapper userMapper;
    // 登陆验证
    public User login(User user) {
        // 调用mapper层，通过用户输入的账号密码去查询数据库的信息
        User resultUser = userMapper.login(user);
        // 如果账号密码正确，resultUser对象不为空，则返回resultUser对象，否则返回null
        return resultUser;
    }
}

